package com.wenson.behavior.visitor;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

/**
 * @ClassName: VisitorClient
 * @Author: luowangcheng
 * @Date: 2024/6/16 15:46
 * @Description:
 */
public class VisitorClient {
    public static void main(String[] args) {
//        Candy candy = new Candy("小兔奶糖", LocalDate.of(2023, 10, 1), 20.00f);
//        Visitor discountVisitor = new DiscountVisitor(LocalDate.of(2024, 1, 1));
//        discountVisitor.visit(candy);

        List<Acceptable> products = Arrays.asList(
                new Candy("小兔奶糖", LocalDate.of(2023, 10, 1), 20.00f),
                new Wine("老猫白酒", LocalDate.of(2022, 1, 1), 1000.00f),
                new Fruit("草莓", LocalDate.of(2023, 12, 26), 10.00f, 2.5f)

        );
        Visitor discountVisitor = new DiscountVisitor(LocalDate.of(2024, 1, 1));
        for (Acceptable product : products) {
            product.accept(discountVisitor);
        }
    }
}
